package com.atguigu.educms.service.impl;

import com.atguigu.educms.entity.EduCourse;
import com.atguigu.educms.mapper.EduCourseMapper;
import com.atguigu.educms.service.EduCourseService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Administrator
* @description 针对表【edu_course(课程)】的数据库操作Service实现
* @createDate 2022-12-21 19:48:38
*/
@Service
public class EduCourseServiceImpl extends ServiceImpl<EduCourseMapper, EduCourse>
implements EduCourseService {
    @Autowired
    private EduCourseMapper eduCourseMapper;

    @Override
    public List<EduCourse> getCourse() {
        QueryWrapper<EduCourse> wrapper = new QueryWrapper<>();
        wrapper.orderByDesc("id");
        wrapper.last("limit 8");
        List<EduCourse> eduCourses = eduCourseMapper.selectList(wrapper);
        return eduCourses;
    }
}
